import {
  getProcessPropertyList,
} from "@/api/process/mesProcess";
import { getDict } from "@/api/common";
import { checkStr, uniqueKey } from "@/utils/judge";
import url from "@/axios/url";
const { mesUrl } = url();
let vm = null;
const sendThis = (_this) => {
  vm = _this;
};
export { sendThis };
import excelUpload from "@/components/excel-upload/excelUpload";
import { exportUrl, exportCellUrl } from "@/api/process/mesProcess";
// 列表头按钮配置
export const operateList = {
  data () {
    const _this = this;
    return {
      operateList: [
        
      ],
    };
  },
};
// 行末按钮配置
export const rowConfig = [
  
];

// 搜索条件配置
export const searchConfig = {
  data () {
    const _this = this;
    return {
      searchConfig: {
        inline: true,
        formDesc: {
          uwbShortCode: {
            type: "input",
            label: $i18n.t("keyClasp.UWBCode"),
          },
          vinCode: {
            type: "input",
            label: "车辆VIN码",
          },
          carInfo: {
            type: "input",
            label: "品牌车系",
          },
          cabinetSiteId: {
            type: "select",
            label: "存放柜区域",
            prop: {
              value: "value",
              text: "description",
            },
            options: async (data) => {
              const list = await getDict('cabinet_area');
              return list.data.result;
            },
          },
          cabinetName: {
            type: "input",
            label: "存放柜名称",
          },
          cabinetCode: {
            type: "input",
            label: "存放柜编码",
          },
          cabinetType: {
            type: "select",
            label: "存放类型",
            prop: {
              value: "value",
              text: "description",
            },
            options: async (data) => {
              const list = await getDict('cabinet_type');
              return list.data.result;
            },
          },
          boxName: {
            type: "input",
            label: "存放位置",
          },
          operatorName: {
            type: "input",
            label: "操作人",
          },
          operatorTimeSort: {
            type: "daterange",
            label: '操作时间',
            attrs: {
              valueFormat: "yyyy-MM-dd",
              searchArrKey: ["operatorTimeFrom", "operatorTimeTo"],
            },
          },
          operationType: {
            type: "select",
            label: "操作类型",
            prop: {
              value: "value",
              text: "description",
            },
            options: async (data) => {
              const list = await getDict('cabinet_operation_type');
              return list.data.result;
            },
          },
        },
      },
    };
  },
};

var validatePass = (rule, value, callback) => {
  setTimeout(() => {
    if (!checkStr(value, "english-number")) {
      callback(new Error($i18n.t("mesProcess.rule8")));
    } else {
      callback();
    }
  }, 100);
};
// 新增/删除表单配置
export const formDescDialogMinxin = {
  data () {
    const self = this;
    return {
      formDescDialog: {
        span: 24,
        disabled: false,
        isShowSubmitBtn: true,
        rules: {
          processCode: [
            { validator: validatePass, trigger: ["change", "blur"] },
          ],
        },
        formDesc: {
          // cabinetSiteId: {
          //   type: "select",
          //   label: '存放柜区域',
          //   layout: 12,
          //   required: true,
          //   disabled: (d) => !!d.id,
          //   prop: {
          //     value: "value",
          //     text: "description",
          //   },
          //   options: async (data) => {
          //     const list = await getDict('cabinet_area');
          //     return list.data.result;
          //   },
          // }
          // processTypeId: {
          //   type: "input",
          //   label: $i18n.t("keyClasp.keyCode"),
          //   layout: 12,
          //   required: true,
          //   disabled: (d) => !!d.id,
          // },
          // processProperty: {
          //   type: "select",
          //   label: $i18n.t("keyClasp.status"),
          //   layout: 12,
          //   required: true,
          //   prop: {
          //     value: "value",
          //     text: "description",
          //   },
          //   options: async (data) => {
          //     const list = await getProcessPropertyList();
          //     return list.data.result;
          //   },
          // },
          // remark: {
          //   type: "textarea",
          //   label: $i18n.t("keyClasp.remark"),
          //   layout: 12,
          //   required: false,
          // },
        },
      },
    };
  },
};

